home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c++ / 329 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  1.8 KB

  1. Path: engnews1.Eng.Sun.COM!taumet!clamage
  2. From: solution@gate.net (Ken Walter)
  3. Newsgroups: comp.std.c++
  4. Subject: Re: Cleaning auto_ptr copy semantics.
  5. Date: 6 Feb 1996 20:59:39 GMT
  6. Organization: Solution Technology
  7. Approved: clamage@eng.sun.com (comp.std.c++)
  8. Message-ID: <4f8djf$1jja@news.gate.net>
  9. References: <01BAF15D.08B8EEE0@dino.int.com> <31153AC5.1776@suphys.physics.su.oz.au>
  10. NNTP-Posting-Host: taumet.eng.sun.com
  11. Content-Type: text
  12. X-Nntp-Posting-Host: dfbfl2-53.gate.net
  13. X-Newsreader: NeoLogic News for OS/2 [version: 4.2]
  14. Content-Length: 1016
  15. X-Lines: 24
  16. Originator: clamage@taumet
  17.  
  18. In message <AUSTERN.96Feb5113807@isolde.mti.sgi.com> - austern@isolde.mti.sgi.c
  19. om (Matt Austern) writes:
  20. [...]
  21. :>:>This leads to an interesting question: given the (current or proposed)
  22. :>semantics of auto_ptr<X>, how many situations can you think of where
  23. :>it is actually useful and correct to transfer ownership from one
  24. :>auto_ptr to another?  
  25. [...]
  26.  
  27. We pass ownership of objects around.  In C you had to "know" if
  28. ownership was passed to know who was responsible for the object.
  29. auto_ptrs with copy and assignment seem fine to me.  You
  30. only do it when you are passing ownership.  As a parameter
  31. I would pass the actual pointer or a ref rather than the autoptr if I 
  32. expected to retain ownership.  On return values it means than the caller
  33. is receiving ownership of an object.  You still can have the dangling 
  34. reference problem, but if that is important (I rarely see it in my 
  35. environment) you use reference counted pointers.
  36.  
  37.  
  38. Ken Walter
  39.  
  40. * All the above is hearsay and the opinion of nobody in particular
  41.  
  42.  
  43. [ comp.std.c++ is moderated.  Submission address: std-c++@ncar.ucar.edu.
  44.   Contact address: std-c++-request@ncar.ucar.edu.  The moderation policy is
  45.   summarized in http://reality.sgi.com/employees/austern_mti/std-c++/policy.html
  46. ]
  47.